<?php
require_once 'vendor/autoload.php';

use Firebase\JWT\JWT;
use Firebase\JWT\Key;

$key = 'webrx';
//定义载荷
$payload = ['user'=>'webrx','iat'=>time(),'exp'=>time()+60];

//$jwt = JWT::encode($payload, $key, 'HS256');

//echo $jwt;

$token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjoid2VicngiLCJpYXQiOjE3MDY3MTY2MjAsImV4cCI6MTcwNjcxNjY4MH0.wnDhP7ajuwjrhMdeND0k93Yc4JbNEcCQfKHOCuWQmG4';
try {
    $decoded = JWT::decode($token, new Key($key, 'HS256'));
    echo '<pre>';
    print_r($decoded);
}catch(Exception $e){
    die($e->getMessage());
}

